package com.example.tests;

public class ContactData implements Comparable<ContactData>{
	private String firstName;
	private String lastName;
	private String address;
	private String phoneHome;
	private String phoneMobile;
	private String phoneWork;
	private String email1;
	private String email2;
	private String bday;
	private String bmonth;
	private String byear;
	private String secAddress;
	private String secHome;

	public ContactData() {
	}
	
	public ContactData(String firstName, String lastName, String address,
			String phoneHome, String phoneMobile, String phoneWork, String email1,
			String email2, String bday, String bmonth, String byear,
			String secAddress, String secHome) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.address = address;
		this.phoneHome = phoneHome;
		this.phoneMobile = phoneMobile;
		this.phoneWork = phoneWork;
		this.email1 = email1;
		this.email2 = email2;
		this.bday = bday;
		this.bmonth = bmonth;
		this.byear = byear;
		this.secAddress = secAddress;
		this.secHome = secHome;
	}

	@Override
	public String toString() {
		return "ContactData [firstName=" + firstName + ", lastName=" + lastName
				+ ", address=" + address + ", phoneHome=" + phoneHome
				+ ", phoneMobile=" + phoneMobile + ", phoneWork=" + phoneWork
				+ ", email1=" + email1 + ", email2=" + email2 + ", bday="
				+ bday + ", bmonth=" + bmonth + ", byear=" + byear
				+ ", secAddress=" + secAddress + ", secHome=" + secHome + "]";
	}


	@Override
	public int hashCode() {
//		final int prime = 31;
		int result = 1;
//		result = prime * result	+ ((firstName == null) ? 0 : firstName.hashCode());
//		result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactData other = (ContactData) obj;
		if (firstName == null) {
			if (other.firstName != null)
				return false;
		} else if (!firstName.equals(other.firstName))
			return false;
		if (lastName == null) {
			if (other.lastName != null)
				return false;
		} else if (!lastName.equals(other.lastName))
			return false;
		return true;
	}

	@Override
	public int compareTo(ContactData other) {
		int result;
		result = this.lastName.toLowerCase().compareTo(other.lastName.toLowerCase()); 
		result = this.firstName.toLowerCase().compareTo(other.firstName.toLowerCase());
		return result;
	}

	
	public ContactData withFirstName(String firstName) {
		this.firstName = firstName;
		return this;
	}

	public ContactData withLastName(String lastName) {
		this.lastName = lastName;
		return this;
	}

	public ContactData withAddress(String address) {
		this.address = address;
		return this;
	}

	public ContactData withPhoneHome(String phoneHome) {
		this.phoneHome = phoneHome;
		return this;
	}

	public ContactData withPhoneMobile(String phoneMobile) {
		this.phoneMobile = phoneMobile;
		return this;
	}

	public ContactData withPhoneWork(String phoneWork) {
		this.phoneWork = phoneWork;
		return this;
	}

	public ContactData withEmail1(String email1) {
		this.email1 = email1;
		return this;
	}

	public ContactData withEmail2(String email2) {
		this.email2 = email2;
		return this;
	}

	public ContactData withBday(String bday) {
		this.bday = bday;
		return this;
	}

	public ContactData withBmonth(String bmonth) {
		this.bmonth = bmonth;
		return this;
	}

	public ContactData withByear(String byear) {
		this.byear = byear; 
		return this;
	}

	public ContactData withSecAddress(String secAddress) {
		this.secAddress = secAddress;
		return this;
	}

	public ContactData withSecHome(String secHome) {
		this.secHome = secHome;
		return this;
	}

	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public String getAddress() {
		return address;
	}

	public String getPhoneHome() {
		return phoneHome;
	}

	public String getPhoneMobile() {
		return phoneMobile;
	}

	public String getPhoneWork() {
		return phoneWork;
	}

	public String getEmail1() {
		return email1;
	}

	public String getEmail2() {
		return email2;
	}

	public String getBday() {
		return bday;
	}

	public String getBmonth() {
		return bmonth;
	}

	public String getByear() {
		return byear;
	}

	public String getSecAddress() {
		return secAddress;
	}

	public String getSecHome() {
		return secHome;
	}
	
}